package domain;

public class Balance extends ModelObject {
	
	private Roommate roommate;
	private double balance;
	
	public Balance(Roommate roommate, double balance) {
		this.balance = balance;
		this.roommate = roommate;
	}

	public Balance() {
	}

	/**
	 * @return the roommateReceiver
	 */
	public Roommate getRoommate() {
		return roommate;
	}

	/**
	 * @param roommateReceiver the roommateReceiver to set
	 */
	public void setRoommate(Roommate roommate) {
		this.roommate = roommate;
	}

	/**
	 * @return the balance
	 */
	public double getBalance() {
		return balance;
	}

	/**
	 * @param balance the balance to set
	 */
	public void setBalance(double balance) {
		this.balance = balance;
	}
	
	public void plus(double balance) {
		this.balance += balance;
	}
	
	public void subtract(double balance) {
		this.balance -= balance;
	}
	
	public Balance clone() {
		Balance newBalance = new Balance();
		newBalance.setId(getId());
		newBalance.setVersion(getVersion());
		newBalance.setBalance(getBalance());
		newBalance.setRoommate(getRoommate());
		return newBalance;
	}
}
